package com.cy.bigevent.Controller;

import com.cy.bigevent.pojo.Result;
import com.cy.bigevent.utils.JwtUtil;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.http.HttpResponse;
import java.util.Map;

@RestController
@RequestMapping("/article")
public class ArticleController {
    @RequestMapping("list")
    public Result<String> list(@RequestHeader(name="Authorization") String token, HttpServletResponse response) {
//        try {//业务成功
//            Map<String, Object> claims = JwtUtil.parseToken(token);
//            return Result.success("所有文章数据");
//        } catch (Exception e) {//业务失败
//         response.setStatus(401);//业务失败响应码
//         return Result.error("未登录");
//        }
        //将校验工作交给拦截器来做
        return Result.success("所有文章数据");
    }
}
